#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "SpWorker.h"
#include <QPushButton>
#include <QWidget>
#include <QThread>
#include <QArrayData>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QWidget
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

signals:
    void notifyConnectSP(const QString& s);
    void notifySend();

private slots:
    void on_btnPower_clicked();

    void on_btnIO1_clicked();

    void on_btnIO2_clicked();

    void on_btnConnect_clicked();

    void on_btnConnectAuto_clicked();

private:
    void switchOnBtn(int i);
    void switchOffBtn(int i);
    void updateIOBtn();

    Ui::MainWindow *ui;
    QThread spThread_;
    SpWorker spWorker_;

    uint32_t io_ = 0x00;
    QPushButton* ioBtnArr_[3];
};
#endif // MAINWINDOW_H
